window.onload =function(){

}
var reader = new FileReader();
function changeValue(e){
    let el = e.target||e.srcElement;
    let file = el.files && el.files[0];
    if(file){
        addListeners(reader);
        reader.readAsDataURL(file);
    }
}

function addListeners(reader) {
    reader.addEventListener('loadstart', handleEvent);
    reader.addEventListener('load', handleEvent);
    reader.addEventListener('loadend', handleEvent);
    reader.addEventListener('progress', handleEvent);
    reader.addEventListener('error', handleEvent);
    reader.addEventListener('abort', handleEvent);
}

function handleEvent(e){
    // eventLog.textContent = eventLog.textContent + `${event.type}: ${event.loaded} bytes transferred\n`;
    console.log(`${event.type}: ${event.loaded} bytes transferred\n`);

    if (event.type === "load") {
        let res = reader.result;
        console.log('读取的结果：');
        console.log(res);
    }
}